package com.lanqiao.attendance.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lanqiao.attendance.pojo.Administrator;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * administrator
 * @author 刘华
 */
@Mapper
public interface AdminMapper extends BaseMapper<Administrator> {
    /**
     * 注册
     * @return
     */
    int register(Administrator admin);

    /**
     * 根据用户名查找出该用户的信息
     * @param admUsername
     * @return
     */
    Administrator selectOne(String admUsername);

    /**
     * 新增管理员
     * @param administrator
     * @return
     */
    boolean addAdmin(Administrator administrator);

    /**
     * 删除管理员
     * @param id
     * @return
     */
    boolean deleteAdmin(long id);

    /**
     * 更新
     * @param administrator
     * @return
     */
    int updateAdmin(Administrator administrator);

    /**
     * 查询管理员列表
     * @return
     */
    List<Administrator> selectAll();

    /**
     * 根据username查询
     * @return
     */
    List<Administrator> selectByLikeName(String admUsername);

    /**
     * 根据id查询
     * @param id
     * @return
     */
    Administrator selectById(long id);

    Administrator queryByAccountAndPwd(String account, String password);

    @Select("select * from tb_administrator where adm_username = #{account}")
    Administrator queryByAccount(String account);

}


